package com.ews.onlineexchange.service.observer;

import javax.ejb.Asynchronous;
import javax.ejb.Stateless;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import javax.persistence.EntityManager;

import com.ews.onlineexchange.model.Bulletin;
import com.ews.onlineexchange.service.TradeService;
import com.ews.onlineexchange.service.qualifier.BulletinAgreeEvent;

@Stateless
public class ConflictTradeInvalidateObserver {
	
	@Inject
	@BulletinAgreeEvent
	Event<Bulletin> bulletinAgreeEvent;
	
	@Inject
	TradeService tradeService;
	@Inject
	EntityManager entityManager;
	

	public void listenBulletinClinch( @Observes @BulletinAgreeEvent Bulletin bulletin ) {
//		bulletin = entityManager.find(Bulletin.class, bulletin.getId());
//		tradeService.invalidateConflictingTrades( bulletin );
	}
	
}
